package com.example.common;

import com.alibaba.fastjson.JSON;

/**
 * @author dangwen1
 * @date 2022年01月06日 11:27
 * @description
 */
public class Selection {
    public static void main(String[] args) {
        int[] array = new int[]{1,21,2134,231,312,4,45,65,9,67,8,8,};
        int temp,tempIndex;
        for (int i =0; i < array.length - 1; i++) {
            tempIndex = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[tempIndex]) {
                    tempIndex = j;
                }
            }
            temp = array[i];
            array[i] = array[tempIndex];
            array[tempIndex] = temp;
        }
        System.out.println(JSON.toJSONString(array));
    }

}
